Bentley James Oakes, Romain Franceschini, Simon Van Mierlo, Hans Vangheluwe
Repeatability = same team and same methods -> same results (with some measure of precision).
Replicability = different team and same methods -> same results.
Reproducibility = different team and different methods -> same results.
S. Schnell, ““Reproducible” Research in Mathematical Sciences Requires Changes in our Peer Review Culture and Modernization of our Current Publication Approach,” Bulletin of Mathematical Biology, vol. 80, no. 12, pp. 3095–3105, Sep. 2018.
Reproducibility figure from: Reproducible Research in Data Science https://github.com/mdozmorov/presentations/
For experimental reproduction, need to document and disseminate:
How can computational notebooks assist?
Code Example:
import datetime
x = datetime.datetime.now()
print("Hello MPM4CPS! The time is: " + str(x))
A small example of a bouncing ball model follows, implemented as a black-box in the Functional Mock-up Interface (FMI) standard.
Objective: Show experimentation and documentation processes within the CNP.
The equations and initial conditions of the model:
%%latex
\begin{equation}
\frac{dh}{dt} = v; \frac{dv}{dt} = -g;\\
\mathit{when}~h < 0~\mathit{then}~v := -e * v;\\
\mathit{initial:}~e = 0.7, g = 9.81
\end{equation}
from pyfmi import load_fmu
model = load_fmu('bouncingBall.fmu')
import pylab as P
def plot(res):
fig = P.figure(figsize=(3, 1.75),)
P.clf()
P.plot(res['time'], res['h'])
P.ylabel('Height (m)')
P.xlabel('Time (s)')
P.suptitle('FMI Bouncing Ball')
P.show()
model.reset()
model.set('h',200)
result = model.simulate(final_time = 20.)
plot(result)
Can experiment with h as 100, 300, 0.01, 0, and observe results
Let's divide entities into three sections:
Users interact with notebooks in various processes, and produce artefacts (such as PDFs or LaTeX)
import pydot
from cbd.BouncingBallCBD import BouncingBallCBD as bbCBD
cbd = bbCBD("myCBD")
cbd.draw()
cbd.simulate()
cbd.draw_scopes()
* https://mybinder.org/v2/git/http%3A%2F%2Fmsdl.uantwerpen.be%2Fgit%2Fbentley%2FNotebookParadigmPaper2019-presentation.git/master
High degree of compatibility between the CNP and MPM:
Next slides will discuss three areas where CNP could better support MPM:
Has three components:
a. a modeling activity such as calibration or verification, with inputs, outputs, and a process description
b. a context with objectives, assumptions, and constraints, and
c. zero or more sub-frames.
Example for the bouncing ball model:
# check if parameters above 1m height, between -65 and 180 C
# assume that all results of the simulation are valid
def bb_frame(height, temp, t):
if height < 1:
raise Exception("Invalid height!")
if temp < -65 or temp > 180:
raise Exception("Invalid temperature!")
model.reset()
model.set('h',height)
return model.simulate(final_time = t)
result = bb_frame(height=100, temp=25, t=20)
plot(result)
User may want to create languages to specify models/experiments during the computational notebook activity
BouncingBallLang Example:
#BouncingBallLang syntax
#[BALL_ID HEIGHT]
#BouncingBallLang semantics
def bb_execute(statement):
ball_id = statement[0]
height = statement[1]
model.reset()
model.set('h',height)
print("Result for bouncing ball '" + ball_id +"':")
plot(model.simulate(final_time = 20))
#BouncingBallLang Usage
ball = ["BALL1", 160]
bb_execute(ball)
Updating language leads to inconsistencies. Can these be detected/fixed automatically?
Presentation available as an online Jupyter notebook: https://mybinder.org/v2/git/http%3A%2F%2Fmsdl.uantwerpen.be%2Fgit%2Fbentley%2FNotebookParadigmPaper2019-presentation.git/master (or http://bit.do/e6yL8)